var sw = document.querySelector('.swiper-wrapper')
var lunbo = [
  'image/zhengzhuang.png'
]

for(let i = 0; i < lunbo.length; i++){
  var div = document.createElement('div')
  div.className = 'swiper-slide'
  var img = document.createElement('img')
  img.src = lunbo[i]
  div.appendChild(img)
  sw.appendChild(div)
}
// 初始化swiper
var swiper = new Swiper(".swiper", {
  // loop: true, // 循环模式选项
  // effect:'cube',
  autoplay:true,

  pagination: {
    // el: ".swiper-pagination",
  },
});

var ul = document.querySelector('.item-ul')

var xhr = new XMLHttpRequest()
xhr.open('get','http://47.116.75.38:8101/web/resource/getActivityList')
xhr.send()
xhr.onload = function () {
  var res = JSON.parse(xhr.response)
  console.log(res)
  res.data.records.forEach(function (item) {
    var li = document.createElement('li')
    li.className = 'ul-li'

    var a = document.createElement('a')
    a.className = 'li-a'
    // a.href = 'anlizi.html?id='+item.id

    var h3 = document.createElement('h3')
    h3.innerText = item.title
    var div = document.createElement('div')
    div.className = 'li-lr'
    var img = document.createElement('img')
    img.src = item.coverPlan

    var div1 = document.createElement('div')
    div1.className = 'lr-r'

    var p = document.createElement('p')
    p.innerText = '开始时间：'+item.startTime
    var p1 = document.createElement('p')
    p1.innerText = '浏览'+item.quota
    var p2 = document.createElement('p')
    p2.innerText = item.place

    var a1 = document.createElement('a')
    // a1.href = 'anlizi.html?'+item.id
    a1.className = 'ydgd'
    a1.innerText = '阅读更多'

    div1.appendChild(p)
    div1.appendChild(p1)
    div1.appendChild(p2)

    div.appendChild(img)
    div.appendChild(div1)

    a.appendChild(h3)
    a.appendChild(div)

    li.appendChild(a)
    li.appendChild(a1)

    ul.appendChild(li)
  })
}
